require("Common/define");
require("Common/functions");

GameRoot={};
local this = GameRoot;

function GameRoot.OnAwake()
	print("hello luaFramework");
	resMgr:LoadPrefab("player",{"player"},this.LoadOK);
end

function GameRoot.LoadOK(objs)
	local prefab = objs[0];
	local go = newObject(prefab);
	transform=go.transform;
	UpdateBeat:Add(this.Update); 
end

function GameRoot.Update()
	if(transform)then
		local dx = Input.GetAxis("Horizontal");
		local dy = Input.GetAxis("Vertical");
		local dir = Vector3.forward*dy+Vector3.right*dx;
		transform:Translate(dir*Time.deltaTime);
	end
end

